<template>
  <div>
    <div style="text-align: left;">学员名：<el-input @change="loadAllStudent()" v-model="userNameChos" style="width: 30%;"
        placeholder="请输入学员昵称"></el-input>
    </div>
    <div style="margin-top: 20px;"></div>
    <el-table :data="page.records" border>

      <el-table-column prop="userImage" label="学员" width="140">
        <template #default="scope">
          <img :src="scope.row.userImage" alt="学员" style="max-width: 110px; max-height: 110px">
        </template>
      </el-table-column>
      <el-table-column prop="userNickname" label="学员昵称" width="115">
      </el-table-column>

      <el-table-column prop="userPhone" label="学员电话" width="140">
      </el-table-column>

      <el-table-column prop="userEmail" label="学员邮箱" width="140">
      </el-table-column>
      <el-table-column prop="userRemark" label="备注" width="160">
      </el-table-column>


    </el-table>

    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page.pageNum"
      :page-sizes="[1, 2, 3, 5]" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper"
      :total="page.total">
    </el-pagination>

  </div>
</template>

<script>
  export default {
    name: "CoachMyStudent",
    data() {
      return {
        page: {},
        param: {
          pageNum: 1,
          pageSize: 5,
        },
        userNameChos: "",
      };
    },
    methods: {

      //分页方法
      handleSizeChange(val) {
        this.param.pageSize = val;
        this.loadAllStudent();
      },
      handleCurrentChange(val) {
        this.param.pageNum = val;
        this.loadAllStudent();
      },
      //载入所有可以申请的场馆
      loadAllStudent() {
        this.$http.post("/account/yUser/pageAllStudent", {
          pageNum: this.param.pageNum,
          pageSize: this.param.pageSize,
          userNickname: this.userNameChos
        }).then(resp => {
          this.page = resp.data.data;
        })
      }
    }
  };
</script>

<style>
</style>
